package com.fusion;

import java.util.Properties;

import com.fusion.core.ResourceSingelton;
import com.stendahls.trace.TraceChannel;

/**
 * #1:10 AM 3/28/2009 Refactored(Adding static initializer block) by Shiva to provide configuration facility to the
 * logging Enable/Disable by User without modifying code by the help of
 * fusion.properties file # fusion.properties for Configuration properties such
 * as Logging enable/Disable by setting log.debug=true/false for Enable/Disable
 * respectively
 * 
 * @author SwethaShivakumar Project: fusion Date: Feb 18, 2009 URL:
 *         http://fusionwiki.co.cc Mail Me At: shiva@fusionproject.co.cc
 */
public class T {
	public static final boolean t;

	static {
		boolean debugEnabled = false;
		try {
			Properties p = new Properties();
			p.load(ResourceSingelton.getRl().getResourceStream(
					"fusion.properties"));
			debugEnabled = p.get("log.debug").toString().equals("true");
		} catch (Exception e) {
			System.err
					.println("Could not load log.debug property from fusion.properties file: "
							+ e);
		} finally {
			t = debugEnabled;
		}
	}

	private static TraceChannel tc = new TraceChannel("main");

	public static void trace(Object message) {
		tc.trace(message);
	}

	public static void debug(Object message) {
		tc.debug(message);
	}

	public static void info(Object message) {
		tc.info(message);
	}

	public static void warn(Object message) {
		tc.warn(message);
	}

	public static void error(Object message) {
		tc.error(message);
	}
}